<template>
  <el-form :model="model" ref="equipmentMagForm" :inline="true" label-width="72px" :label-position="'left'">
  <el-row class="search-title">条件搜索</el-row>
  <el-form-item prop="equipment_no">
    <el-input v-model="model.equipment_site" prefix-icon="el-icon-search" placeholder="设备ID" clearable></el-input>
  </el-form-item>
    <el-form-item prop="equipment_site">
      <el-input v-model="model.equipment_site" prefix-icon="el-icon-search" placeholder="设备位置" clearable></el-input>
    </el-form-item>
  <el-form-item>
    <el-button class="btn-search" type="primary" @click="handleQueryParkingMag">搜索</el-button>
  </el-form-item>
  <collapse-vertical>
    <div v-show="isDisplay">
      <div>
        <el-form-item prop="equipment_manager" label="管理单位">
          <el-input v-model="model.equipment_manager" placeholder="请输入管理单位" clearable ></el-input>
        </el-form-item>
        <el-form-item prop="equipment_operator" label="维修单位">
          <el-input v-model="model.equipment_operator" placeholder="请输入维修单位" clearable></el-input>
        </el-form-item>
      </div>
      <div>
        <el-form-item prop="equipment_type" label="设备类型">
          <el-radio-group v-model="model.equipment_type" size="small">
            <el-radio   v-for="item in equipmentTypes" :label="item.id" >{{item.value}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <div>
        <el-form-item prop="equipment_model" label="设备型号">
          <el-radio-group v-model="model.equipment_model" size="small">
            <el-radio   v-for="item in equipmentModels" :label="item.id" >{{item.value}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <div>
        <el-form-item prop="park_status" label="设备状态">
          <el-radio-group v-model="model.equipment_status" size="small">
            <el-radio   v-for="item in statusTypes" :label="item.id" >{{item.value}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <el-form-item prop="park_date" label="采购时间">
        <el-date-picker v-model="model.equipment_buy_time" type="date" placeholder="选择采购时间" clearable format="yyyy 年MM 月dd 日"
         value-format="yyyy-MM-dd">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button class="btn-mini-form" @click="handleQueryParkingMag"
                   size="mini">提交
        </el-button>
        <el-button class="btn-mini-form" @click="handleResetParkingMag"
                   size="mini">重置
        </el-button>
      </el-form-item>
    </div>
  </collapse-vertical>
  <el-row style="text-align: center"><el-button style="border: none;background-color: transparent" size="small" @click="isShow" :icon="isDisplay?'el-icon-arrow-up':'el-icon-arrow-down'"></el-button></el-row>
  <person-child-dialog-dw :dialogDwVisible.sync="dialogDwVisibleParkingMag" @dwName="selectDwnameParkingMag" :dwType="0"></person-child-dialog-dw>
  </el-form>
</template>

<script>
  /* eslint-disable */
  import PersonChildDialogDw from "../../organizationManagement/personChild/personChildDialogDw";
  import ElFormItem from "element-ui/packages/form/src/form-item";
  import {selDictonary} from "../../../api/dictionary";
  import {getChargeStandard} from "../../../api/parkingResource/parkingMag";
  import CollapseVertical from '../../../utils/collapseVertical'

  export default {
    components: {
      ElFormItem,
      PersonChildDialogDw,
      CollapseVertical
    },
    name: "equipment-mag-form",
    created() {
      this.initData()
    },
    data() {
      return {
        dialogDwVisibleParkingMag: false,
        isDisplay: false,
        model: {
          park_date: '',
          park_eroad: '',
          park_jdbsc: '',
          park_name: '',
          park_no: '',
          park_road: '',
          park_roadkind: '',
          park_sroad: '',
          park_ssdw: '',
          park_status: '',
          park_sfbz: '',
          equipment_no: '',
          equipment_site: '',
          equipment_desc: '',
          equipment_status: '',
          equipment_type: '',
          equipment_person: '',
          equipment_model: '',
          equipment_manager: '',
          equipment_operator: '',

        },

        sfbzs: [],
        parkstatuss: [],
        roadkinds: [],
        equipmentTypes: [
          { id: '0', value: '诱导屏' },
          { id: '1', value: '其他' },
        ],
        equipmentModels: [
          { id: '0', value: '未知' },
          { id: '1', value: 'P16双色显示屏' },
          { id: '2', value: 'P32双色显示屏' },
        ],
        statusTypes: [
          { id: '0', value: '空闲' },
          { id: '1', value: '正常' },
          { id: '2', value: '故障' },
        ],

      }
    },
    methods: {
      handleQueryParkingMag() {
        this.$emit('handleQueryParkingMag', this.model)
      },
      handleResetParkingMag() {
        this.$refs['equipmentMagForm'].resetFields()
      },
      handleDwSelect() {
        this.dialogDwVisibleParkingMag = true
      },
      selectDwnameParkingMag(val) {
        this.model.park_ssdw = val.orgname
      },
      initData() {
        this.$emit('handleQueryParkingMag', this.model);

        /*        selDictonary().then(res => {
                  for (var item in res) {
                    if (res[item].id == "roadkind") {//
                      this.roadkinds = res[item].comboboxDetailList
                    } else if (res[item].id == "enableflag") {
                      this.parkstatuss = res[item].comboboxDetailList
                    }
                  }
                })
                getChargeStandard().then(res => {
                  this.sfbzs = res
                })*/
      },
      isShow(){
        this.isDisplay =!this.isDisplay
      }

    }
  }
</script>

<style scoped>

</style>
